#pragma once

#include <stdlib.h>
#include <limits>
#include <math.h>


#define CHECK_FOR_INF
//#define ONE_INDEXING

class Hungarian
{
private:
	int looped;
public:
	Hungarian();
	void assignmentoptimal(int *assignment, double *cost, double *distMatrix, int nOfRows, int nOfColumns);
	void buildassignmentvector(int *assignment, int *starMatrix, int nOfRows, int nOfColumns);
	void computeassignmentcost(int *assignment, double *cost, double *distMatrix, int nOfRows);
	void step2a(int *assignment, double *distMatrix, int *starMatrix, int *newStarMatrix, int *primeMatrix, int *coveredColumns, int *coveredRows, int nOfRows, int nOfColumns, int minDim);
	void step2b(int *assignment, double *distMatrix, int *starMatrix, int *newStarMatrix, int *primeMatrix, int *coveredColumns, int *coveredRows, int nOfRows, int nOfColumns, int minDim);
	void step3 (int *assignment, double *distMatrix, int *starMatrix, int *newStarMatrix, int *primeMatrix, int *coveredColumns, int *coveredRows, int nOfRows, int nOfColumns, int minDim);
	void step4 (int *assignment, double *distMatrix, int *starMatrix, int *newStarMatrix, int *primeMatrix, int *coveredColumns, int *coveredRows, int nOfRows, int nOfColumns, int minDim, int row, int col);
	void step5 (int *assignment, double *distMatrix, int *starMatrix, int *newStarMatrix, int *primeMatrix, int *coveredColumns, int *coveredRows, int nOfRows, int nOfColumns, int minDim);	
};
